<!DOCTYPE html>
<html class="no-js" xmlns:th="http://www.thymeleaf.org">
<head>
<title>注册账号</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- bootstrap-css -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- //bootstrap-css -->
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- font CSS -->
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!-- font-awesome icons -->
<link rel="stylesheet" href="css/font.css" type="text/css"/>
<link href="css/font-awesome.css" rel="stylesheet"> 
<!-- //font-awesome icons -->
</head>
<body class="signup-body">
		<div class="agile-signup">	
		
			<div class="content2">
				<div class="grids-heading gallery-heading signup-heading">
					<h2>注册账号</h2>
				</div>
				<form th:action="@{/register}" th:method="post" th:id="registerform" onsubmit="return check(this)">
					<input type="tel" name="username"  th:placeholder="手机号" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Username';}">
					<input type="text"  name="organization"  th:placeholder="单位名称" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Phone';}">
					<input type="password" name = "password" th:placeholder="输入密码" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}">
					<input type="password" name="rePassword" th:placeholder="再次输入密码" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
					<div class="signin-text">
						<div class="text-left">
							<p>
								<span  style="color: red; " th:if="${ not #strings.isEmpty(msg)} " th:utext="${msg}"></span>
								<span id="msg" style="color: red;"></span>
							</p>
						</div>
					</div>
					<input type="submit" class="register" th:value="注册"></input>
				</form>
				<div><a style="color: #337ab7;text-decoration: underline;" href="login.html">我有账号，现在登录</a></div>
			</div>
			
			<!-- footer -->
			<div class="copyright">
			</div>
			<!-- //footer -->
			
		</div>
		<script th:src="@{js/md5.js}"></script>
		<script>
			function check(form) {
				document.getElementById("msg").innerText="";
				if (form.username.value == "")
				{
					document.getElementById("msg").innerText="请输入手机号";
					return  false;
				}
				else if(form.password.value == "")
				{
					document.getElementById("msg").innerText="请输入密码";
					return  false;
				}
				else if(form.rePassword.value == "")
				{
					document.getElementById("msg").innerText="请再次输入密码";
					return  false;
				}
				else if (form.password.value != form.rePassword.value)
				{
					document.getElementById("msg").innerText="两次输入密码不一致";
					return  false;
				}
				else
				{
					var username = form.username.value;
					var pass = form.password.value ;
					var rePass = form.rePassword.value;
					var salt = "123456";
					var permit = hex_md5(username + pass + salt);
					var rePermit = hex_md5(username + rePass + salt);
					form.password.value = permit;
					form.rePassword.value = rePermit;
					return true;
				}
			}
			</script>
	
</body>
</html>
